﻿using System;
using Ninject;
using Legazpi.Payroll.BusinessLogic.Services.Interfaces;
using Legazpi.Payroll.DataAccess.DataObjects;

namespace Legazpi.Payroll.Web.PopupBoxes
{
    public partial class SSSDialogBox : System.Web.UI.Page
    {
        [Inject]
        public ISSSTableService _sssTableService { get; set; }

        protected SSSTable Model { get; private set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                int id ;
                int.TryParse(Request.QueryString["id"],out id);                
                if (id > 0)
                {
                    //Update Data
                    Model = _sssTableService.GetById(id);
                }
            }
            Model = Model ?? new SSSTable { Id = 0 };                
        }
    }
}